package com.frcdi.qms.web.controller.material;

import com.frcdi.qms.common.core.controller.BaseController;
import com.frcdi.qms.common.core.domain.AjaxResult;
import com.frcdi.qms.common.core.page.TableDataInfo;
import com.frcdi.qms.material.domain.InboundRecord;
import com.frcdi.qms.material.service.InboundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName InboundController
 * @Author Mr.Han
 * @Description //TODO $
 * @create 2024/7/8 17:47
 **/
@RestController
@RequestMapping("/inbound")
public class InboundController  extends BaseController {
    @Autowired
    private InboundService inboundService;

    @PostMapping("/add")
    public AjaxResult addInboundRecord(@RequestBody InboundRecord record) {
        inboundService.addInboundRecord(record);
        return success("Inbound record added successfully");
    }

    @GetMapping("/list/{materialId}")
    public TableDataInfo getInboundRecordsByMaterialId(@PathVariable Integer materialId) {
        startPage();
        return getDataTable(inboundService.getInboundRecordsByMaterialId(materialId));
    }
}
